package com.my.simple.entity.auth;

import java.util.Objects;

public class UserRole {
    private Integer roleId;
    private Integer userId;

    public UserRole(int userId, int roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public Integer getUserId() {
        return userId;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + (roleId == null ? 0 : roleId.hashCode());
        result = 31 * result + (userId == null ? 0 : userId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (null == obj) {
            return false;
        }

        if (this == obj) {
            return true;
        }

        if (getClass() != obj.getClass()) {
            return false;
        }

        UserRole newObj = (UserRole) obj;
        return Objects.equals(userId, newObj.userId) && Objects.equals(roleId, newObj.roleId);
    }

    @Override
    public String toString() {
        return "UserRole{" +
                "roleId=" + roleId +
                ", userId=" + userId +
                '}';
    }
}
